package com.xwj;

import org.openjdk.jol.info.ClassLayout;

/**
 * 测试对象在jvm中内存布局
 *
 * @author xwj
 * @date 2020/10/30
 */
public class JavaObjectMemory {
    public static void main(String[] args) {
//        Object obj = new Object();
//        System.out.println(ClassLayout.parseInstance(obj).toPrintable());

        Obj obj = new Obj();
        System.out.println(ClassLayout.parseInstance(obj).toPrintable());
    }
}

class Obj {
    /**
     * 占用1个byte
     */
    private byte i = 0;
}
